package com.hbmcc.heshenghuo.flow

import android.util.Log
import androidx.databinding.ObservableInt
import com.google.gson.Gson

/**
 * @author 支豪亮
 * @date 2021/11/23 3:05 下午
 * @des 流量设置
 */
data class FloorMyFrgFlow(
    val topLeftList: List<FloorMyFrgTopItem>? = null,

    val topRightList: List<FloorMyFrgTopItem>? = null,
) {
    var leftIndex: Int = 0

    var rightIndex: Int = 0

    var isLeftStop:Boolean = false

    var isRightStop:Boolean = false

    fun current(isFrist:Boolean) = if(isFrist) initList(leftIndex,topLeftList) else  initList(rightIndex,topRightList)

    private fun initList(currentIndex: Int, list: List<FloorMyFrgTopItem>?): FloorMyFrgTopItem? {
        Log.e("getAdMarketByPoint","load1")
        if (list.isNullOrEmpty()) return null
        Log.e("getAdMarketByPoint","load2")
        if (currentIndex >= list.size || currentIndex < 0) return null
        Log.e("getAdMarketByPoint","${currentIndex} : ${Gson().toJson(list)}")
        return list[currentIndex]
    }
}

data class FloorMyFrgTopItem(
    /**
     * 通用流量
     */
    var title: String? = null,

    /**
     * 角标
     */
    var superTitle: String? = null,

    /**
     * 前缀 流量总量
     */
    var onePrefix: String? = null,

    /**
     *  2180M
     */
    var one: String? = null,

    /**
     * 前缀 剩下流量
     */
    var twoPrefix: String? = null,

    /**
     *  200M
     */
    var two: String? = null,

    /**
     * 剩余的百分比
     */
    var ratio: String? = null)